package com.guigu.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.guigu.pojo.CompanyRunningWater;
import com.guigu.pojo.ShopInfo;
import com.guigu.pojo.*;
import com.guigu.service.CompanyRunningWaterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;
import java.util.Map;

@CrossOrigin
@RestController
public class CompanyRunningWaterController {

    @Autowired
    CompanyRunningWaterService companyRunningWaterService;
    //商户营收
    @GetMapping("queryAllys.action")
    public List<CompanyRunningWater> queryAllys(CompanyRunningWater companyRunningWater, Integer loginUserId){
        return companyRunningWaterService.queryAllys(companyRunningWater,loginUserId);
    }

    //后台每月收入
    @GetMapping("queryWaters.action")
    public List<CompanyRunningWater> queryWaters(CompanyRunningWater water){
      return   companyRunningWaterService.queryWaters(water);
    }

    //后台统计每月商品销售量
    @GetMapping("queryBuyNum.action")
    public List<ShopInfo> queryBuyNum(CompanyRunningWater water){
        return companyRunningWaterService.queryBuyNum(water);
    }

    //供应商营收
    @GetMapping("queryAllgysys.action")
    public List<CompanyRunningWater> queryAllgysys(CompanyRunningWater companyRunningWater, Integer loginUserId){
        return companyRunningWaterService.queryAllgysys(companyRunningWater,loginUserId);
    }

    //分页查询
    @GetMapping("companyRunningWater_queryPage.action")
    public Page<CompanyRunningWater> queryPage(CompanyRunningWater water,
                                               @RequestParam(value = "pageno", defaultValue = "1") Integer pageno,
                                               @RequestParam(value = "pagesize", defaultValue = "5") Integer pagesize) {
        return companyRunningWaterService.queryPage(water,pageno,pagesize);
    }

    //商户工资结算
    @GetMapping("merchantsAndSettlement.action/{id}")
    public Map merchantsAndSettlement(@PathVariable Integer id) {
        return companyRunningWaterService.merchantsAndSettlement(id);
    }

    //商户工资结算查询
    @GetMapping("merchantsAndSettlementQuery.action")
    public com.guigu.service.utils.Page merchantsAndSettlementQuery(Orders orders,
                                                                    @RequestParam(value = "pageno", defaultValue = "1") Integer pageno,
                                                                    @RequestParam(value = "pagesize", defaultValue = "5") Integer pagesize) {
        return companyRunningWaterService.merchantsAndSettlementQuery(orders,pageno,pagesize);
    }

    //供应商本月收入
    @GetMapping("thisMonthRevenue.action/{id}")
    public Double thisMonthRevenue(@PathVariable Integer id) {
        return companyRunningWaterService.thisMonthRevenue(id);
    }
}
